/* $RCSFile: ADNDynSalesDetailBase.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynSalesDetailBase.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
	/// <summary>
	/// Base class with common definitions for salesorderdateail / quotedetail / invoicedetail
	/// </summary>
    public class ADNDynSalesDetailBase : DynEntity
	{

        public override bool HasPrimaryField
        {
            get{   return false;}
        }

        public override bool HasOwnerProperty
        {
            get{   return false;}
        }

        public override bool HasOwninguser
        {
            get{   return true;}
        }

        public override bool HasBusinessUnitProperty
        {
            get{   return false;}
        }

        public override bool HasOwningBusinessUnitProperty
        {
            get{   return true;}
        }

        public override bool OwningbusinessunitAsUniqueIdentifier
        {
            get{   return true;}
        }

        /// <summary>
		/// Reserved for template methods: do not use directly
		/// </summary>
        public ADNDynSalesDetailBase(): base()
		{}

		public ADNDynSalesDetailBase(CRMWrapperBase w,string entityName)
			: base(w, entityName)
		{}

        public ADNDynSalesDetailBase(ResetWrapperHandler fn,string entityName)
			: base(fn, entityName)
		{}

		public ADNDynSalesDetailBase(CRMWrapperBase w,string entityName, Guid CrmId)
			: base(w,entityName, CrmId)
		{}

		public ADNDynSalesDetailBase(ResetWrapperHandler fn,string entityName, Guid CrmId)
			: base(fn,entityName, CrmId)
		{}

        public ADNDynSalesDetailBase(CRMWrapperBase w,string entName,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(w,entName,e,prop,s)
		{}
        public ADNDynSalesDetailBase(ResetWrapperHandler fn,string entName,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(fn,entName,e,prop,s)
		{}



        /// <summary>
        /// Gets or sets the line item number for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public int lineitemnumber
        {
            get
            {
                return NumberPropertyValue(CrmStr.lineitemnumber);
            }
            set
            {
                AddNumberProperty(CrmStr.lineitemnumber,value);
            }
        }

        /// <summary>
        /// Gets or sets the requested delivery date for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string requestdeliveryby
        {
            get
            {
                return DateTimePropertyValue(CrmStr.requestdeliveryby);
            }
            set
            {
                AddDateTimeProperty(CrmStr.requestdeliveryby,value);
            }
        }
 
        /// <summary>
        /// Gets the exchange rate for the currency associated with the product with respect to the base currency.
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal exchangerate
        {
            get
            {
                return DecimalPropertyValue(CrmStr.exchangerate);
            }
            set
            {
                AddDecimalProperty(CrmStr.exchangerate,value);
            }
        }

        /// <summary>
        /// Gets and sets the ID of the currency associated with the product.         
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid transactioncurrencyid
        {
            get
            {
                return LookupPropertyValue(CrmStr.transactioncurrencyid);
            }
            set
            {
                AddLookupProperty(CrmStr.transactioncurrencyid,CrmStr.uom,value);
            }
        }

        public string transactioncurrencyName
        {
            get
            {
                return LookupPropertyName(CrmStr.transactioncurrencyid);
            }
        }

        /// <summary>
        /// Contains the description of the product detail. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string description 
        {
            get
            {
                return StringPropertyValue(CrmStr.description);
            }
            set
            {
                AddStringProperty(CrmStr.description,value);
            }
        }
 
        /// <summary>
        /// Gets or sets the values that indicates if the sales order detail  (order product) uses the catalog price or a custom price. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public bool ispriceoverridden
        {
            get 
            {
                return BooleanPropertyValue(CrmStr.ispriceoverridden);
            }
            set
            {
            
                AddBooleanProperty(CrmStr.ispriceoverridden,value);
            }
        }

        /// <summary>
        /// Gets or sets the values that indicates  whether the product is a write-in product or an existing product. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public bool isproductoverridden
        {
            get 
            {
                return BooleanPropertyValue(CrmStr.isproductoverridden);
            }
            set
            {
            
                AddBooleanProperty(CrmStr.isproductoverridden,value);
            }
        }
 
        /// <summary>
        /// Gets or sets the product description for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string productdescription
        {
            get
            {
                return StringPropertyValue(CrmStr.productdescription);
            }
            set
            {
                AddStringProperty(CrmStr.productdescription,value);
            }
        }

        /// <summary>
        /// Gets or sets the ID of the salesperson associated with the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid salesrepid
		{
			get
			{
				return LookupPropertyValue(CrmStr.salesrepid);
			}
			set
			{
				AddLookupProperty(CrmStr.salesrepid,CrmStr.systemuser, value);
			}
		}

        public string salesrepName
        {
            get
            {
                return LookupPropertyName(CrmStr.salesrepid);
            }
        }
         
        /// <summary>
        /// Gets or sets the ID of the product associated with the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid productid
        {
            get 
            {
                return LookupPropertyValue(CrmStr.productid);
            }
            set
            {
                AddLookupProperty(CrmStr.productid,CrmStr.product,value);
            }
        }
 
        public string productName
        {
            get 
            {
                return LookupPropertyName(CrmStr.productid);
            }
        }
 
        /// <summary>
        /// Gets or sets the ID for the unit that is associated with the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid uomid 
        {
            get
            {
                return LookupPropertyValue(CrmStr.uomid);
            }
            set
            {
                AddLookupProperty(CrmStr.uomid,CrmStr.uom,value);
            }
        }

        public string uomName
        {
            get
            {
                return LookupPropertyName(CrmStr.uomid);
            }
        }

        /// <summary>
        /// Gets or sets the quantity for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal quantity
        {
            get
            {
                return DecimalPropertyValue(CrmStr.quantity);
            }
            set
            {
                AddDecimalProperty(CrmStr.quantity,value);
            }
        }

        /// <summary>
        /// Gets or sets the pricing error for the order. 
        /// None 
        /// Detail Error
        /// Missing Price Level
        /// Inactive Price Level
        /// Missing Quantity
        /// Missing Unit Price
        /// Missing Product
        /// Invalid Product
        /// Missing Pricing Code
        /// Invalid Pricing Code
        /// Missing UOM
        /// Product Not In Price Level
        /// Missing Price Level Amount
        /// Missing Price Level Percentage
        /// Missing Price
        /// Missing Current Cost
        /// Missing Standard Cost
        /// Invalid Price Level Amount
        /// Invalid Price Level Percentage
        /// Invalid Price
        /// Invalid Current Cost
        /// Invalid Standard Cost
        /// Invalid Rounding Policy
        /// Invalid Rounding Option
        /// Invalid Rounding Amount
        /// Price Calculation Error
        /// Invalid Discount Type
        /// Discount Type Invalid State
        /// Invalid Discount
        /// Invalid Quantity
        /// Invalid Pricing Precision
        /// Missing Product Default UOM
        /// Missing Product UOM Schedule
        /// Inactive Discount Type
        /// Invalid Price Level Currency
        /// Price Attribute Out Of Range
        /// Base Currency Attribute Overflow
        /// Base Currency Attribute Underflow
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public int pricingerrorcode
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.pricingerrorcode);
            }
            set
            {
                AddPicklistProperty(CrmStr.pricingerrorcode,value);
            }
        }
         
        public string pricingerrorcodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.pricingerrorcode);
            }
        }

        /// <summary>
        /// Gets the price of the sales order detail (order product) before applying discounts  and adding taxes.
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal baseamount
        {
            get
            {
                return MoneyPropertyValue(CrmStr.baseamount);
            }
            set
            {
                AddMoneyProperty(CrmStr.baseamount,value);
            }
        }

        /// <summary>
        /// Gets the price of the sales order detail (order product) before applying discounts  and adding taxes.
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal baseamount_base
        {
            get
            {
                return MoneyPropertyValue(CrmStr.baseamount_base);
            }
        }

        /// <summary>
        /// Gets the subtotal of the sales order detail (order product) after applying discounts and adding taxes. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal extendedamount
        {
            get
            {
                return MoneyPropertyValue(CrmStr.extendedamount);
            }
            set
            {
                AddMoneyProperty(CrmStr.extendedamount,value);
            }
        }

        /// <summary>
        /// Gets the base currency equivalent of the subtotal for the sales order detail (order product) after applying discounts and adding taxes. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal extendedamount_base
        {
            get
            {
                return MoneyPropertyValue(CrmStr.extendedamount_base);
            }
        }

        /// <summary>
        /// Gets or sets the customized discount amount for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal manualdiscountamount
        {
            get
            {
                return MoneyPropertyValue(CrmStr.manualdiscountamount);
            }
            set
            {
                AddMoneyProperty(CrmStr.manualdiscountamount,value);
            }
        }

        /// <summary>
        /// Gets the base currency equivalent of the customized discount amount for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal manualdiscountamount_base
        {
            get
            {
                return MoneyPropertyValue(CrmStr.manualdiscountamount_base);
            }
        }

        /// <summary>
        /// Gets the volume discount amount for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal volumediscountamount
        {
            get
            {
                return MoneyPropertyValue(CrmStr.volumediscountamount);
            }
            set
            {
                AddMoneyProperty(CrmStr.volumediscountamount,value);
            }
        }

        /// <summary>
        /// Gets the base currency equivalent of the volume discount amount for the order product. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal volumediscountamount_base
        {
            get
            {
                return MoneyPropertyValue(CrmStr.volumediscountamount_base);
            }
        }

        /// <summary>
        /// Gets or sets the price per unit for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal priceperunit
        {
            get
            {
                return MoneyPropertyValue(CrmStr.priceperunit);
            }
            set
            {
                AddMoneyProperty(CrmStr.priceperunit,value);
            }
        }

        /// <summary>
        /// Gets the base currency equivalent of the price per unit for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal priceperunit_base
        {
            get
            {
                return MoneyPropertyValue(CrmStr.priceperunit_base);
            }
        }

        /// <summary>
        /// Gets or sets the tax amount for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal tax
        {
            get 
            {
                return MoneyPropertyValue(CrmStr.tax);
            }
            set
            {
                AddMoneyProperty(CrmStr.tax,value);
            }
        }

        /// <summary>
        /// Gets the base currency equivalent of the tax amount for the sales order detail (order product). 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public decimal tax_base
        {
            get 
            {
                return MoneyPropertyValue(CrmStr.tax_base);
            }
        }
    
        /// <summary>
        /// Gets the ID of the user who owns the sales order detail (order product).
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid owninguser
        {
            get 
            {
                return UniqueIdentifierPropertyValue(CrmStr.owninguser);
            }
            set
            {
                AddUniqueIdentifierProperty(CrmStr.owninguser,value);
            }
        }

        /// <summary>
        /// Gets the ID of the business unit that owns the sales order detail (order product).
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public Guid owningbusinessunit
        {
            get 
            {
                return UniqueIdentifierPropertyValue(CrmStr.owningbusinessunit);
            }
            set
            {
                AddUniqueIdentifierProperty(CrmStr.owningbusinessunit,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_line1
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptoline1);
            }
            set
            {
                AddStringProperty(CrmStr.shiptoline1,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_line2
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptoline2);
            }
            set
            {
                AddStringProperty(CrmStr.shiptoline2,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_line3
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptoline3);
            }
            set
            {
                AddStringProperty(CrmStr.shiptoline3,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_city
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptocity);
            }
            set
            {
                AddStringProperty(CrmStr.shiptocity,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_county
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptocounty);
            }
            set
            {
                AddStringProperty(CrmStr.shiptocounty,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_country
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptocountry);
            }
            set
            {
                AddStringProperty(CrmStr.shiptocountry,value);
            }
        }

        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_postalcode
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptopostalcode);
            }
            set
            {
                AddStringProperty(CrmStr.shiptopostalcode,value);
            }
        }
        
        /// <summary>
        /// Gets or sets the fax number for the shipping address. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_fax
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptofax);
            }
            set
            {
                AddStringProperty(CrmStr.shiptofax,value);
            }
        }

        /// <summary>
        /// Gets or sets the telephone number associated with the billing address. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_telephone
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptophone);
            }
            set
            {
                AddStringProperty(CrmStr.shiptophone,value);
            }
        }

        /// <summary>
        /// Gets or sets the name to enter in the shipping address. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_name
        {
            get
            {
                return StringPropertyValue(CrmStr.shipto_name);
            }
            set
            {
                AddStringProperty(CrmStr.shipto_name,value);
            }
        }

        /// <summary>
        /// Gets or sets the state or province in the shipping address. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_stateorprovince
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptostate);
            }
            set
            {
                AddStringProperty(CrmStr.shiptostate,value);
            }
        }

        /// <summary>
        /// Gets or sets the contact name for the shipping address. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public string shipto_contactname
        {
            get
            {
                return StringPropertyValue(CrmStr.shiptocontactname);
            }
            set
            {
                AddStringProperty(CrmStr.shiptocontactname,value);
            }
        }

        /// <summary>
        /// Gets or sets the freight terms for the shipping address.
        /// FOB, No Charge
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public int shipto_freighttermscode
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.shipto_freighttermscode);
            }
            set
            {
                AddPicklistProperty(CrmStr.shipto_freighttermscode,value);
            }
        }
         
        public string shipto_freighttermscodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.shipto_freighttermscode);
            }
        }

        /// <summary>
        /// Gets or sets the value that indicates if the sales order detail (order product) is shipped or picked up by the customer. 
        /// </summary>
        [CrmDynAttribute(CrmStr.salesorderdetail), CrmDynAttribute(CrmStr.quotedetail),CrmDynAttribute(CrmStr.invoicedetail)]
        public bool willcall
        {
            get 
            {
                return BooleanPropertyValue(CrmStr.willcall);
            }
            set
            {
            
                AddBooleanProperty(CrmStr.willcall,value);
            }
        }
    }
}